/* GUI CONVERTED from rqarp.p (converter v1.76) Fri Jul 20 18:34:09 2001 */
/* rqarp.p - Approver Report                                                */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                      */
/* All rights reserved worldwide.  This is an unpublished work.             */
/* $Revision: 1.4.1.6 $                                                    */
/*V8:ConvertMode=FullGUIReport                                              */
/* REVISION 8.5       LAST MODIFIED: 04/15/97   BY: *J1Q2* Patrick Rowan    */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane        */
/* REVISION: 8.6E     LAST MODIFIED: 05/06/98   BY: *K1PK* A. Shobha        */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan       */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb              */
/* Old ECO marker removed, but no ECO header exists *F0PN*                  */
/* $Revision: 1.4.1.6 $    BY: Mugdha Tambe      DATE: 06/19/01 ECO: *N0Y9*  */
/* $Revision: 1.4.1.6 $    BY: Doug Norton       DATE: 07/20/01 ECO: *N10L*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/
/*!
 ----------------------------------------------------------------------------
 DESCRIPTION: Create approver report.
              Supports the multi-line Purchase Requisition Module of MFG/PRO.

 Notes:
 ============================================================================
!*/

/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rqarp_p_1 "Cost Center"
/* MaxLen: Comment: */

&SCOPED-DEFINE rqarp_p_2 "Include Vertical"
/* MaxLen: Comment: */

&SCOPED-DEFINE rqarp_p_4 "Effective Date"
/* MaxLen: Comment: */

&SCOPED-DEFINE rqarp_p_5 "Include Horizontal"
/* MaxLen: Comment: */

&SCOPED-DEFINE rqarp_p_6 "Include Product Line"
/* MaxLen: Comment: */

&SCOPED-DEFINE rqarp_p_7 "Include Job"
/* MaxLen: Comment: */

&SCOPED-DEFINE rqarp_p_8 "Print Details"
/* MaxLen: Comment: */

&SCOPED-DEFINE rqarp_p_9 "Type"
/* MaxLen: Comment: */

&SCOPED-DEFINE rqarp_p_10 "Sub-Account"
/* MaxLen: Comment: */

&SCOPED-DEFINE rqarp_p_11 "Sort Option"
/* MaxLen: Comment: */

&SCOPED-DEFINE rqarp_p_12 "User!User Name"
/* MaxLen:4 Comment: */

&SCOPED-DEFINE rqarp_p_13 "Appr Lvl!Rvw  Lvl"
/* MaxLen:8 Comment: */

&SCOPED-DEFINE rqarp_p_14 "Appr Amt!Rvw  Amt"
/* MaxLen:8 Comment: */

&SCOPED-DEFINE rqarp_p_15 "Appr Req!Rvw  Req"
/* MaxLen:8 Comment: */

&SCOPED-DEFINE rqarp_p_16 "From Sub!To   Sub"
/* MaxLen:8 Comment: */

&SCOPED-DEFINE rqarp_p_17 "From CC!To   CC"
/* MaxLen:7 Comment: */

&SCOPED-DEFINE rqarp_p_18 "Start!End"
/* MaxLen:8 Comment: */

&SCOPED-DEFINE rqarp_p_19 "Catg!Type"
/* MaxLen:4 Comment: */

&SCOPED-DEFINE rqarp_p_20 "Entity!Job"
/* MaxLen:7 Comment: */

&SCOPED-DEFINE rqarp_p_21 "Site!PL"
/* MaxLen:8 Comment: */

&SCOPED-DEFINE rqarp_p_22 "Description"
/* MaxLen:15 Comment: */

/* ********** End Translatable Strings Definitions ********* */

/* CONSTANTS */
{rqconst.i}

/* VARIABLES */
{rqavars.i}

define variable approver       like rqa_apr no-undo.
define variable approver1      like rqa_apr no-undo.
define variable entity         like rqa_entity no-undo.
define variable entity1        like rqa_entity no-undo.
define variable category       like rqa_category no-undo.
define variable category1      like rqa_category no-undo.
define variable sub_acct       like rqa_sub_from
   label {&rqarp_p_10} no-undo.
define variable sub_acct1      like rqa_sub_from no-undo.
define variable cost_ctr       like rqa_cc_from
   label {&rqarp_p_1} no-undo.
define variable cost_ctr1      like rqa_cc_from no-undo.
define variable job_name       like rqa_job no-undo.
define variable job_name1      like rqa_job no-undo.
define variable site           like rqa_site no-undo.
define variable site1          like rqa_site no-undo.
define variable prod_line      like rqa_prod_line no-undo.
define variable prod_line1     like rqa_prod_line no-undo.
define variable apr_level      like rqa_apr_level no-undo.
define variable apr_level1     like rqa_apr_level no-undo.
define variable rvw_level      like rqa_rvw_level no-undo.
define variable rvw_level1     like rqa_rvw_level no-undo.
define variable start_date     like rqa_start
   label {&rqarp_p_4} no-undo.
define variable var_acct_from_desc like rqc_desc no-undo.
define variable var_acct_to_desc   like rqc_desc no-undo.
define variable var_acct_from      like rqcd_acct_from no-undo.
define variable var_acct_to        like rqcd_acct_to no-undo.
define variable var_type_code      as character no-undo.
define variable var_type_desc      as character
   format "x(16)"
   label {&rqarp_p_9} no-undo.

define variable sortoption as integer format "9"
   label {&rqarp_p_11}  initial 1 no-undo.
define variable sorttextoption as character extent 5
   format "x(19)" no-undo.

define variable l_field1 as character format "x(15)" no-undo.
define variable l_field2 as character no-undo.
define variable v_desc   as character no-undo.
define variable l_cont   as character no-undo.

/* LOGICALS */
define variable print_details      like mfc_logical
   label {&rqarp_p_8} no-undo.
define variable include_horizontal     like mfc_logical
   label {&rqarp_p_5}
   initial yes no-undo.
define variable include_vertical   like mfc_logical
   label {&rqarp_p_2}
   initial yes no-undo.
define variable include_job        like mfc_logical
   label {&rqarp_p_7}
   initial yes no-undo.
define variable include_prod_line  like mfc_logical
   label {&rqarp_p_6}
   initial yes no-undo.

/* COUNTERS */
define variable rqcd_det_cntr as integer.

/* FRAME A: SELECTION FORM */

/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
approver        colon 21
   approver1       colon 49 label {t001.i}
   entity          colon 21
   entity1         colon 49 label {t001.i}
   category        colon 21
   category1       colon 49 label {t001.i}
   sub_acct        colon 21
   sub_acct1       colon 49 label {t001.i}
   cost_ctr        colon 21
   cost_ctr1       colon 49 label {t001.i}
   job_name        colon 21
   job_name1       colon 49 label {t001.i}
   site            colon 21
   site1           colon 49 label {t001.i}
   prod_line       colon 21
   prod_line1      colon 49 label {t001.i}
   apr_level       colon 21
   apr_level1      colon 49 label {t001.i}
   rvw_level       colon 21
   rvw_level1      colon 49 label {t001.i}
   skip(1)
   include_horizontal  colon 21
   sortoption          colon 49
   sorttextoption[1]   colon 56 no-label
   include_vertical    colon 21
   sorttextoption[2]   colon 56 no-label
   include_job         colon 21
   sorttextoption[3]   colon 56 no-label
   include_prod_line   colon 21
   sorttextoption[4]   colon 56 no-label
   print_details       colon 21
   sorttextoption[5]   colon 56 no-label
   start_date          colon 21
 SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

/* FRAME H1 : Header for each group in sort option */
FORM /*GUI*/ 
   l_field1 at 1 no-label
   l_field2 at 18 no-label
   v_desc   format "x(50)" at 40 label {&rqarp_p_22}
with STREAM-IO /*GUI*/  frame h1 width 132.

/* SET EXTERNAL LABELS */
setFrameLabels(frame h1:handle).

/* FRAME H2 : Header for each group in sort option showing Continue*/
FORM /*GUI*/ 
   l_field1 at 1 no-label
   l_field2 at 18 no-label
   v_desc   format "x(50)" at 40  label {&rqarp_p_22}
   l_cont   format "x(12)" at 109 no-label
with STREAM-IO /*GUI*/  frame h2 width 132.

/* SET EXTERNAL LABELS */
setFrameLabels(frame h2:handle).

/* FRAME C2 : FRAME TO DISPLAY APPROVER INFORMATION */
FORM /*GUI*/ 
   rqa_apr               at 1    column-label {&rqarp_p_12}
   rqa_apr_level         at 35   column-label {&rqarp_p_13}
   var_apr_level_amt     at 45   column-label {&rqarp_p_14}
   rqa_apr_req           at 63   column-label {&rqarp_p_15}
   rqa_entity            at 73   column-label {&rqarp_p_20}
   rqa_category          at 83   column-label {&rqarp_p_19}
   rqa_sub_from          at 92   column-label {&rqarp_p_16}
   rqa_cc_from           at 102  column-label {&rqarp_p_17}
   rqa_start             at 112  column-label {&rqarp_p_18}
   rqa_site              at 122  column-label {&rqarp_p_21}

with STREAM-IO /*GUI*/  frame c2 down width 132.

/* SET EXTERNAL LABELS */
setFrameLabels(frame c2:handle).

/* FRAME DETAILS :  TO DISPLAY DETAIL INFORMATION */
FORM /*GUI*/ 
   space(20)
   rqa_alt_apr[1]
   var_alt1_apr_name
   rqa_admin_apr
   var_admin_apr_name
with STREAM-IO /*GUI*/  frame details down width 132.

/* SET EXTERNAL LABELS */
setFrameLabels(frame details:handle).

/****************** SET INITIAL VALUES ******************/
assign
   sorttextoption[1] = "1 - " +  getTermLabel("BY",2) + " "
                              +  getTermLabel("TYPE",14)
   sorttextoption[2] = "2 - " +  getTermLabel("BY",2) + " "
                              +  getTermLabel("CATEGORY",14)
   sorttextoption[3] = "3 - " +  getTermLabel("BY",2) + " "
                              +  getTermLabel("ENTITY",14)
   sorttextoption[4] = "4 - " +  getTermLabel("BY",2) + " "
                              +  getTermLabel("SUB_ACCOUNT",14)
   sorttextoption[5] = "5 - " +  getTermLabel("BY",2) + " "
                              +  getTermLabel("COST_CENTER",14)
   l_cont            = "("    + getTermLabel("CONTINUE",8) + ")" .

{wbrp01.i}

/* THIS PROCEDURE print_report IS PLACED HERE TO AVOID COMPILE TIME */
/* ERRORS WITH  GUI-CONVERTER. */

PROCEDURE print_report :
/* Call include file as per the sort option selected to print the report */

   define input parameter sortopt as integer no-undo.

   CASE sortopt:
   when 1 then do :
      {rqarp.i &bycl="rqa_type" }
   end.
   when 2 then do:
     {rqarp.i &bycl="rqa_category" }
   end.
   when 3 then do:
     {rqarp.i &bycl="rqa_entity" }
   end.
   when 4 then do:
     {rqarp.i &bycl="rqa_sub_from" }
   end.
   when 5 then do:
     {rqarp.i &bycl="rqa_cc_from" }
   end.
   END CASE.
END PROCEDURE.


/*GUI*/ {mfguirpa.i true "printer" 132 " " " " " "  }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:


   display sorttextoption with frame a .
   bcdparm = "".
   {mfquoter.i approver}
   {mfquoter.i approver1}
   {mfquoter.i entity}
   {mfquoter.i entity1}
   {mfquoter.i category}
   {mfquoter.i category1}
   {mfquoter.i sub_acct}
   {mfquoter.i sub_acct1}
   {mfquoter.i cost_ctr}
   {mfquoter.i cost_ctr1}
   {mfquoter.i job_name}
   {mfquoter.i job_name1}
   {mfquoter.i site}
   {mfquoter.i site1}
   {mfquoter.i prod_line}
   {mfquoter.i prod_line1}
   {mfquoter.i apr_level}
   {mfquoter.i apr_level1}
   {mfquoter.i rvw_level}
   {mfquoter.i rvw_level1}
   {mfquoter.i include_horizontal}
   {mfquoter.i include_vertical}
   {mfquoter.i include_job}
   {mfquoter.i include_prod_line}
   {mfquoter.i print_details}
   {mfquoter.i sortoption}
   {mfquoter.i start_date}

   if  approver1  = hi_char then approver1  = ''.
   if  entity1    = hi_char then entity1    = ''.
   if  category1  = hi_char then category1  = ''.
   if  sub_acct1  = hi_char then sub_acct1  = ''.
   if  cost_ctr1  = hi_char then cost_ctr1  = ''.
   if  job_name1  = hi_char then job_name1  = ''.
   if  site1      = hi_char then site1      = ''.
   if  prod_line1 = hi_char then prod_line1 = ''.

   assign
      apr_level1 = 99
      rvw_level1 = 99
      start_date = today.

   if  c-application-mode  <> 'WEB' then
   
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


   {wbrp06.i &command = update
             &fields = " approver
                         approver1
                         entity
                         entity1
                         category
                         category1
                         sub_acct
                         sub_acct1
                         cost_ctr
                         cost_ctr1
                         job_name
                         job_name1
                         site
                         site1
                         prod_line
                         prod_line1
                         apr_level
                         apr_level1
                         rvw_level
                         rvw_level1
                         include_horizontal
                         include_vertical
                         include_job
                         include_prod_line
                         print_details
                         start_date
                         sortoption"
             &frm = "a"}

   if c-application-mode <> 'WEB' or
      (c-application-mode = 'WEB' and
      c-web-request begins 'DATA' )
   then do:
      if approver1 = '' then approver1 = hi_char.
      if entity1 = '' then entity1 = hi_char.
      if category1 = '' then category1 = hi_char.
      if sub_acct1 = '' then sub_acct1 = hi_char.
      if cost_ctr1 = '' then cost_ctr1 = hi_char.
      if job_name1 = '' then job_name1 = hi_char.
      if site1 = '' then site1 = hi_char.
      if prod_line1 = '' then prod_line1 = hi_char.
      if start_date = ? then start_date = low_date.
   end. /* IF c-application-mode <> 'WEB' */

   /* OUTPUT DESTINATION SELECTION */
   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i "printer" 132 " " " " " " " " }
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:




   {mfphead.i}

   run print_report(input sortoption).

   
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


end.  /* REPEAT */

{wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" approver approver1 entity entity1 category category1 sub_acct sub_acct1 cost_ctr cost_ctr1 job_name job_name1 site site1 prod_line prod_line1 apr_level apr_level1 rvw_level rvw_level1 include_horizontal include_vertical include_job include_prod_line print_details start_date sortoption "} /*Drive the Report*/
